/*!
 * \file ast_omega_syntax_visitor.h
 *
 * \brief Declarations for the omega syntax generation visitor for ast.
 *
 * \date Started: 7/12/2010
 * \date Last Modified: 7/27/2010
 * \authors Alan LaMielle
 * \authors Ian Craig
 * \authors Nicholas Jeanette
 *
 * Copyright (c) 2010, Colorado State University <br>
 * All rights reserved. <br>
 * See ../../COPYING for details. <br>
 */

#ifndef ASTOSV_H
#define ASTOSV_H

#include <iegenlib/iegenlib.h>

#include <sstream>
using std::stringstream;

namespace iegenlib{

/*!
 * \class OmegaSyntax
 *
 * \brief Outputs the original (or as close to the original) input string for
 *        the AST structure
 *
 * This class is specifically designed so that once the AST is built, the
 * visitor will recreate the original string, or as close as it can get to it.
 * The purpose of this class is for testing of the parser that is used to build
 * the AST in the first place.
 */
class OmegaSyntax : public DepthFirstVisitorAdapter{
public:

  inline void defaultIn(Node* node){};

  inline void defaultOut(Node* node){};

  void PresSetCase(PresSet* node);
  void PresRelationCase(PresRelation* node);
  void VarTupleCase(VarTuple* node);
  void VarTupleIn(VarTuple* node);
  void VarTupleOut(VarTuple* node);
  void VarExpIn(VarExp* node);
  void NormExpCase(NormExp* node);
  void NormExpOut(NormExp* node);
  void FuncExpIn(FuncExp* node);
  void FuncExpCase(FuncExp* node);
  void ConjunctionCase(Conjunction* node);
  void InequalityOut(Inequality* node);
  void EqualityOut(Equality* node);

  /*!
   * @return the original input string after it has been parser and put back
   * together in an equivelent form.
   */
  inline string getOmega(){return original;}

private:

  ///The string being built up to the original input string.
  list<string> conj_list;
  string original;
  string original1;
};

}//end namespace iegenlib

#endif
